<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>设置错误处理函数</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="yaf-dispatcher.setdefaultmodule.html">Yaf_Dispatcher::setDefaultModule</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="yaf-dispatcher.setrequest.html">Yaf_Dispatcher::setRequest</a></div>
 <div class="up"><a href="class.yaf-dispatcher.html">Yaf_Dispatcher</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="yaf-dispatcher.seterrorhandler" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">Yaf_Dispatcher::setErrorHandler</h1>
  <p class="verinfo">(Yaf &gt;=1.0.0)</p><p class="refpurpose"><span class="refname">Yaf_Dispatcher::setErrorHandler</span> &mdash; <span class="dc-title">设置错误处理函数</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-yaf-dispatcher.seterrorhandler-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type"><a href="class.yaf-dispatcher.html" class="type Yaf_Dispatcher">Yaf_Dispatcher</a></span> <span class="methodname"><strong>Yaf_Dispatcher::setErrorHandler</strong></span>
    ( <span class="methodparam"><span class="type"><span class="type call">call</span></span> <code class="parameter">$callback</code></span>
   , <span class="methodparam"><span class="type">int</span> <code class="parameter">$error_types</code></span>
   )</div>

  <p class="para rdfs-comment">
    设置错误处理函数，一般在<a href="yaf.appconfig.html#configuration.yaf.dispatcher.throwexception" class="link">application.dispatcher.throwException</a>关闭的情况下，Yaf会在出错的时候触发错误，这个时候，如果设置了错误处理函数，则会把控制交给错误处理函数处理。
  </p>
  <p class="para">
   因此，当错误发生的时候这个错误处理函数将被调用。
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-yaf-dispatcher.seterrorhandler-parameters">
  <h3 class="title">参数</h3>
  <dl>

   
    <dt>
<em><code class="parameter">callback</code></em></dt>

    <dd>

     <p class="para">
      错误处理的回调函数
     </p>
    </dd>

   
   
    <dt>
<em><code class="parameter">error_types</code></em></dt>

    <dd>

     <p class="para">
      
     </p>
    </dd>

   
  </dl>

 </div>


 <div class="refsect1 returnvalues" id="refsect1-yaf-dispatcher.seterrorhandler-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">

  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-yaf-dispatcher.seterrorhandler-seealso">
  <h3 class="title">参见</h3>
  <ul class="simplelist">
   <li class="member"><span class="methodname"><a href="yaf-dispatcher.throwexception.html" class="methodname" rel="rdfs-seeAlso">Yaf_Dispatcher::throwException()</a> - 开启/关闭异常抛出</span></li>
   <li class="member"><span class="methodname"><a href="yaf-application.getlasterrorno.html" class="methodname" rel="rdfs-seeAlso">Yaf_Application::getLastErrorNo()</a> - 获取最后产生的错误的错误代码</span></li>
   <li class="member"><span class="methodname"><a href="yaf-application.getlasterrormsg.html" class="methodname" rel="rdfs-seeAlso">Yaf_Application::getLastErrorMsg()</a> - 获取最近产生的错误的错误信息</span></li>
  </ul>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="yaf-dispatcher.setdefaultmodule.html">Yaf_Dispatcher::setDefaultModule</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="yaf-dispatcher.setrequest.html">Yaf_Dispatcher::setRequest</a></div>
 <div class="up"><a href="class.yaf-dispatcher.html">Yaf_Dispatcher</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
